package com.ftg.learn.pattern.singleton;

/**
 * 单例设计模式 的饱汉模式
 * @author kangjx
 * @createTime 2022/8/9
 */
public class Sinleton2 {

    private static Sinleton2 s;

    private Sinleton2(){
        System.out.println("构造方法 ");
    }

    //a[new] b[new] c[new]
    public  static Sinleton2 getInstance(){
        if(s == null){
            s = new Sinleton2();
        }
        return s;
    }

}
